home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / muds / lpmud312.tar / lpmud312 / mudlib_simul_e < prev    next >
Text File  |  1991-12-10  |  2KB  |  84 lines

  1. /*
  2.  * This is a mudlib file. Copy it to /obj/simul_efun.c, or
  3.  * wherever the get_simul_efun() in master.c says.
  4.  * The functions defined in this file should only be replacements of efuns
  5.  * no longer supported. Don't use these functions any longer, use the
  6.  * replacement instead.
  7.  */
  8.  
  9. #pragma strict_types
  10. #pragma save_types
  11.  
  12. /*
  13.  * The ls() function is no longer needed, as get_dir() can do the same
  14.  * work.
  15.  */
  16. void ls(string path) {
  17.     int max, i, len, tmp;
  18.     status trunc_flag;
  19.     string *dir;
  20. #ifndef COMPAT_FLAG
  21.     seteuid(geteuid(previous_object()));
  22. #endif
  23.     dir = get_dir (path);
  24. #if defined(COMPAT_FLAG) && 0
  25.     if (path[0] == '/')
  26.     path = extract(path, 1);
  27.     if (path != "")
  28.     path += "/";
  29. #else
  30.     if (path != "/")
  31.     path += "/";
  32. #endif
  33.     if (!dir) {
  34.         write("No such directory.\n");
  35.         return;
  36.     }
  37.     if (sizeof(dir) > 999)
  38.     {
  39.         dir = dir[0..998];
  40.         trunc_flag = 1;
  41.     }
  42.     max = (int)("/obj/master"->test_dir(dir,path));
  43.     if (max > 79)
  44.         max = 79;
  45.     for (i=0; i < sizeof(dir); i++) {
  46.     string name;
  47.             name = dir[i];
  48.     tmp = strlen(name);
  49.     if (len + tmp > 79) {
  50.         len = 0;
  51.         write("\n");
  52.     }
  53.     write(name);
  54.         if (len + max > 79) {
  55.             write("\n");
  56.             len = 0;
  57.         } else {
  58.             write(extract(
  59. "                                                                                ",
  60.                 80-max+tmp));
  61.             len += max;
  62.         }
  63.     }
  64.     write("\n");
  65.     if (trunc_flag) write("***TRUNCATED***\n");
  66. }
  67.  
  68. /*
  69.  * The old 'slice_array' is no longer needed. Use range argument inside
  70.  * a pair of brackets instead.
  71.  */
  72. mixed *slice_array(mixed *arr, int from, int to) {
  73.     return arr[from..to];
  74. }
  75. #if 0
  76. /*
  77.  * filter_objects() has been renamed to filter_array().
  78.  */
  79. mixed *filter_objects(mixed *list, string str, object ob, mixed extra) {
  80.     return filter_array(list, str, ob, extra);
  81. }
  82.  
  83. #endif
  84.